package com.guigu.controller.lq.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.controller.lq.mapper.LqPhysicaljgMapper;
import com.guigu.controller.lq.pojo.LqPhysicaljg;
import com.guigu.controller.lq.pojo.PageVO;
import com.guigu.controller.lq.service.LqPhysicaljgservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LqPhysicaljgServiceimpl implements LqPhysicaljgservice {
@Autowired
LqPhysicaljgMapper lqPhysicaljgMapper;
    public PageVO<LqPhysicaljg> find(Integer page, Integer num, String vipname) {
        PageHelper.startPage(page,num);
        LqPhysicaljg lqPhysicaljg = new LqPhysicaljg();
        lqPhysicaljg.setVipname(vipname);
        List<LqPhysicaljg> all = lqPhysicaljgMapper.findjg(lqPhysicaljg);
        PageInfo<LqPhysicaljg> pageInfo = new PageInfo<LqPhysicaljg>(all);
        long total = pageInfo.getTotal();
        PageVO<LqPhysicaljg> PageVO = new PageVO<LqPhysicaljg>();
        PageVO.setTotal(total);
        PageVO.setRows(all);
        return PageVO;
    }

    public int tzadd(LqPhysicaljg lqPhysicaljg) {
        return lqPhysicaljgMapper.insert(lqPhysicaljg);
    }

    public LqPhysicaljg selid(Integer id) {
        return lqPhysicaljgMapper.selid(id);
    }

    public int tzup(LqPhysicaljg lqPhysicaljg) {
        return lqPhysicaljgMapper.updateByPrimaryKey(lqPhysicaljg);
    }

    public int tzdel(Integer id) {
        return lqPhysicaljgMapper.deleteByPrimaryKey(id);
    }

    public List<LqPhysicaljg> findtz(String vipid) {
        return lqPhysicaljgMapper.findtz(vipid);
    }
}
